//
//  THJAllClassVC.m
//  THJXHW
//
//  Created by 河南德艺 on 2017/11/7.
//  Copyright © 2017年 河南德艺. All rights reserved.
//

#import "THJAllClassVC.h"
#import "THJAllClassView.h"
#import "THJSearchVC.h"
@interface THJAllClassVC ()<THJAllClassViewDelegate>
{
    UITextField * searchTF;
}
@end

@implementation THJAllClassVC
-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.tabBarController.tabBar.hidden = YES;
//    self.navigationController.navigationBar.hidden = NO;
}
-(void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [searchTF removeFromSuperview];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUI];
    if(KIsiPhoneX){
        [self setXClassNavBarWithTitle:@"全部分类"];
    }else{
        [self setNavBarWithTitle:@"全部分类"];
    }
    
}
-(void)pop{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)setUI{
    self.automaticallyAdjustsScrollViewInsets = NO;
//    分类view
    THJAllClassView * view = [[THJAllClassView alloc] initWithMid:self.midType];
    view.frame=CGRectMake(0, 64, ScreenWidth, ScreenHeight-64);
    if(KIsiPhoneX){
        view.frame=CGRectMake(0, 74, ScreenWidth, ScreenHeight-64);
        UIView * view2 = [[UIView alloc] initWithFrame:CGRectMake(0, 64, ScreenWidth, 10)];
        [self.view addSubview:view2];
        view2.backgroundColor = MainColor;
    }
    view.delegate = self;
    [self.view addSubview:view];
}
#pragma mark -- THJAllClassViewDelegate --
-(void)selectedCatName:(NSString *)catname CatId:(NSString *)catid{
    [self.delegate itemSelectName:catname CatId:catid];
    if([self.from isEqual:@"商城"]){
        THJSearchVC * vc = [THJSearchVC new];
        vc.formType = @"全部分类";
        vc.keyword = catname;
        [self.navigationController pushViewController:vc animated:YES];
    }
   
}
- (IBAction)backBtnAction:(id)sender {

    [self.navigationController popViewControllerAnimated:YES];
}
@end
